//
//  ParametersADSR.m
//  CocoaSynth
//
//  Created by Thomas Dupont on 22/02/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "ParametersADSR.h"

#import "ModuleADSRViewController.h"
#import "ModuleADSRProtocol.h"

@implementation ParametersADSR

@synthesize module;
@synthesize attackSlider, decaySlider, sustainSlider, releaseSlider;
@synthesize attackText, decayText, sustainText, releaseText;

- (void)load
{
	[(id<ModuleADSRProtocol>)[module model] setAttack:[attackSlider intValue]];
	[(id<ModuleADSRProtocol>)[module model] setDecay:[attackSlider intValue]];
	[(id<ModuleADSRProtocol>)[module model] setSustain:[attackSlider intValue]];
	[(id<ModuleADSRProtocol>)[module model] setRelease:[attackSlider intValue]];
}

- (IBAction)attackChange:(id)sender
{
	[attackText setTitleWithMnemonic:[NSString stringWithFormat:@"%i",[attackSlider intValue]]];
	[(id<ModuleADSRProtocol>)[module model] setAttack:[attackSlider intValue]];
}

- (IBAction)decayChange:(id)sender
{
	[decayText setTitleWithMnemonic:[NSString stringWithFormat:@"%i",[decaySlider intValue]]];
	[(id<ModuleADSRProtocol>)[module model] setDecay:[attackSlider intValue]];
}

- (IBAction)sustainChange:(id)sender
{
	[sustainText setTitleWithMnemonic:[NSString stringWithFormat:@"%i",[sustainSlider intValue]]];
	[(id<ModuleADSRProtocol>)[module model] setSustain:[attackSlider intValue]];
}

- (IBAction)releaseChange:(id)sender
{
	[releaseText setTitleWithMnemonic:[NSString stringWithFormat:@"%i",[releaseSlider intValue]]];
	[(id<ModuleADSRProtocol>)[module model] setRelease:[attackSlider intValue]];
}


@end
